<template>
    <view class="share">
        <u-button shape="circle" :ripple="true" :custom-style="customStyle" :hair-line="false" size="medium" open-type="share">
            <u-icon color="#18b566" size="50" name="zhuanfa"></u-icon>
        </u-button>
    </view>
</template>
<script>
export default {
    data() {
        return {
            customStyle: {
                width: '20rpx',
                height: '50rpx',
                backgroundColor: 'rgba(0,0,0,0)'
            }
        };
    },
    methods: {
        share() {
            /* uni.share({
               provider: "weixin",
               scene: "WXSceneSession",
               type: 1,
               summary: "我正在使用HBuilderX开发uni-app，赶紧跟我一起来体验！",
               success: function (res) {
                   console.log("success:" + JSON.stringify(res));
               },
               fail: function (err) {
                   console.log("fail:" + JSON.stringify(err));
               }
           }); */
        }
    },
    onReady() {
        // console.log(getCurrentPages());
        uni.setNavigationBarTitle({
            title: '这是xx的文章详情'
        });
    },
    onShow(){
       uni.hideNavigationBarLoading()
        
    },
    onShareAppMessage: function(res) {
        if (res.from === 'button') {
            // 通过按钮触发
            var data = res.target.dataset;
            return {
                title: data.title,
                path: '/pages/articleDetail/articleDetail',
                imageUrl: '/static/images/logo.png',
                success: function(res) {
                    // 转发成功
                    console.log('转发成功');
                },
                fail: function(res) {
                    // 转发失败
                    console.log('转发失败');
                }
            };
        }
        //通过右上角菜单触发
        return {
            title: '为您斟酒',
            path: '/pages/home/home',
            imageUrl: '/static/images/logo.png'
        };
    }
};
</script>

<style scoped lang="scss">
.share {
    position: fixed;
    top: 500rpx;
    right: 10rpx;
    z-index: 999;
}
</style>
